home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc / OpenDoc Development / Build Support / BMCompile < prev    next >
Encoding:
Text File  |  1996-02-19  |  3.4 KB  |  145 lines  |  [TEXT/MPS ]

  1. execute "{OpenDocBuildSupportDir}BMCommon"
  2.  
  3. set exit 0
  4.  
  5. alias CSrcFile 'evaluate "{srcFile}" =~ /?+.c/'
  6. alias CppSrcFile 'evaluate "{srcFile}" =~ /?+.cp[p]*/'
  7.  
  8. set srcFile "`windows -q | streamedit -e '$ Print .;/?+/ Delete'`"
  9.  
  10. set TargetArch "`streamedit -e "{capat}" "{ProjPrefs}"`"
  11. execute "{OpenDocBuildSupportDir}BMSettings"
  12.  
  13. # ----------------------------
  14. # MODIFY READ-ONLY SOURCE FILE
  15. # ----------------------------
  16.  
  17. if "{1}" == "-mro"
  18.     ModifyReadOnly "{srcFile}"
  19.  
  20. # ----------------------
  21. # PREPROCESS SOURCE FILE
  22. # ----------------------
  23.  
  24. else if "{1}" == "-p"
  25.     (evaluate "{srcFile}" =~ /?+:([¬:]+.c[p]*)®1/) ∑∑ dev:null
  26.     set srcFileName "{®1}"
  27.     unset ®1
  28.  
  29.     set prepFile "{TempFolder}{srcFileName}.e"
  30.         
  31.     if "{TargetArch}" == "PPC"
  32.         if ( `CSrcFile` )
  33.             set buildcmd "{PPCCPreprocessor} {PPCCompilerOptions} {ODCIncludes} -e -l '{prepFile}'"
  34.         else if ( `CppSrcFile` )
  35.             set buildcmd "{PPCCppPreprocessor} {PPCCompilerOptions} {ODCppIncludes} -e -l '{prepFile}'"
  36.         else
  37.             Echo # Error: not sure how to preprocess this file
  38.             Exit 1
  39.         end
  40.     else
  41.         if ( `CSrcFile` )
  42.             set buildcmd "{68kCPreprocessor} -c {68kCompilerOptions} {ODCIncludes} -e -o '{prepFile}'"
  43.         else if ( `CppSrcFile` )
  44.             set buildcmd "{68kCppPreprocessor} {68kCompilerOptions} {ODCppIncludes} -e -o '{prepFile}'"
  45.         else
  46.             Echo # Error: not sure how to preprocess this file
  47.             Exit 1
  48.         end
  49.     end
  50.     
  51.     #Echo "{buildcmd} '{srcFile}'" >> "{WorkSheet}"
  52.     {buildcmd} "{srcFile}" ∑∑ "{Worksheet}"
  53.     open "{prepFile}"
  54.  
  55. # -------
  56. # COMPILE
  57. # -------
  58.  
  59. else if "{1}" == "-c" 
  60.     if "{TargetArch}" == "PPC"
  61.         if ( `CSrcFile` )
  62.             set buildcmd "{PPCCCompiler} {PPCCompilerOptions} {ODCIncludes}"
  63.         else if ( `CppSrcFile` )
  64.             set buildcmd "{PPCCppCompiler} {PPCCompilerOptions} {ODCppIncludes}"
  65.         else
  66.             Echo # Error: not sure how to compile this file
  67.             Exit 1
  68.         end
  69.     else
  70.         if ( `CSrcFile` )
  71.             set buildcmd "{68kCCompiler} {68kCompilerOptions} {ODCIncludes}"
  72.         else if ( `CppSrcFile` )
  73.             set buildcmd "{68kCppCompiler} {68kCompilerOptions} {ODCppIncludes}"
  74.         else
  75.             Echo # Error: not sure how to compile this file
  76.             Exit 1
  77.         end
  78.     end
  79.     
  80.     #Echo "{buildcmd} '{srcFile}' -o '{TempFolder}'" >> "{WorkSheet}"
  81.     {buildcmd} "{srcFile}" -o "{TempFolder}" ∑∑ "{Worksheet}"
  82.  
  83. # -----------
  84. # DISASSEMBLE
  85. # -----------
  86.  
  87. else if "{1}" == "-d"
  88.     (evaluate "{srcFile}" =~ /?+:([¬:]+.c[p]*)®1/) ∑∑ dev:null
  89.     set srcFileName "{®1}"
  90.     unset ®1
  91.  
  92.     set disFile "{TempFolder}{srcFileName}.o.dis"
  93.         
  94.     if ( `exists "{disFile}"` == "" )
  95.         set ans `Confirm "“{srcFileName}” has not been compiled yet. Shall I compile and then disassemble it?"`
  96.         
  97.         if ( ans == 0 )
  98.             BMCompile -c
  99.         else if ( ans == 4 )
  100.             Exit 0
  101.         end
  102.     end
  103.     
  104.     if "{TargetArch}" == "PPC"
  105.         dumpxcoff -tb -u -ln "{TempFolder}{srcFileName}.o" > "{disFile}"
  106.     else
  107.         dumpobj "{TempFolder}{srcFileName}.o" > "{disFile}"
  108.     end
  109.     
  110.     open "{disFile}"
  111.     
  112. # ------------
  113. # MAKE PROJECT
  114. # ------------
  115.  
  116. else if "{1}" == "-m"
  117.     if "{TargetArch}" == "PPC"
  118.         if ( `CSrcFile` )
  119.             set compiler "{PPCCCompiler}"
  120.         else if ( `CppSrcFile` )
  121.             set compiler "{PPCCppCompiler}"
  122.         else
  123.             Echo # Error: not sure how to compile this file
  124.             Exit 1
  125.         end
  126.     else
  127.         if ( `CSrcFile` )
  128.             set compiler "{68kCCompiler}"
  129.         else if ( `CppSrcFile` )
  130.             set compiler "{68kCppCompiler}"
  131.         else
  132.             Echo # Error: not sure how to compile this file
  133.             Exit 1
  134.         end
  135.     end
  136.  
  137.     set makefile "`streamedit -e "{pfpat}" "{ProjPrefs}"`"
  138.     BuildOpenDocPart -f "{makefile}" -b "{compiler}"
  139.  
  140. end
  141.  
  142.  
  143. set exit 1
  144.  
  145.